home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / libg_261.zip / libg_261 / libg++ / src / gen / SLStack.hP < prev    next >
Text File  |  1992-04-14  |  2KB  |  110 lines

  1. // This may look like C code, but it is really -*- C++ -*-
  2. /* 
  3. Copyright (C) 1988 Free Software Foundation
  4.     written by Doug Lea (dl@rocky.oswego.edu)
  5.  
  6. This file is part of the GNU C++ Library.  This library is free
  7. software; you can redistribute it and/or modify it under the terms of
  8. the GNU Library General Public License as published by the Free
  9. Software Foundation; either version 2 of the License, or (at your
  10. option) any later version.  This library is distributed in the hope
  11. that it will be useful, but WITHOUT ANY WARRANTY; without even the
  12. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  13. PURPOSE.  See the GNU Library General Public License for more details.
  14. You should have received a copy of the GNU Library General Public
  15. License along with this library; if not, write to the Free Software
  16. Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  17. */
  18.  
  19.  
  20. #ifndef _<T>SLStack_h
  21. #ifdef __GNUG__
  22. #pragma interface
  23. #endif
  24. #define _<T>SLStack_h 1
  25.  
  26. #include "<T>.SLList.h"
  27. #include "<T>.Stack.h"
  28.  
  29. class <T>SLStack : public <T>Stack
  30. {
  31.   <T>SLList     p;
  32.  
  33. public:
  34.                 <T>SLStack();
  35.                 <T>SLStack(const <T>SLStack& s);
  36.                 ~<T>SLStack();
  37.  
  38.   void          operator = (const <T>SLStack&);
  39.  
  40.   void          push(<T&> item);
  41.   <T>           pop();
  42.   <T>&          top();               
  43.   void          del_top();
  44.  
  45.   int           empty();
  46.   int           full();
  47.   int           length();
  48.  
  49.   void          clear();
  50.  
  51.   int           OK();
  52.  
  53. };
  54.  
  55. inline <T>SLStack::<T>SLStack() :p() {}
  56. inline <T>SLStack::<T>SLStack(const <T>SLStack& a) : p(a.p) {}
  57. inline <T>SLStack::~<T>SLStack() {}
  58.  
  59. inline void <T>SLStack::push(<T&> item)
  60. {
  61.   p.prepend(item);
  62. }
  63.  
  64. inline <T> <T>SLStack::pop()
  65. {
  66.   return p.remove_front();
  67. }
  68.  
  69. inline <T>& <T>SLStack::top()
  70. {
  71.   return p.front();
  72. }
  73.  
  74. inline void <T>SLStack::del_top()
  75. {
  76.   p.del_front();
  77. }
  78.  
  79. inline void <T>SLStack::operator =(const <T>SLStack& s)
  80. {
  81.   p = s.p;
  82. }
  83.  
  84. inline int <T>SLStack::empty() 
  85. {
  86.   return p.empty();
  87. }
  88.  
  89. inline int <T>SLStack::full() 
  90. {
  91.   return 0;
  92. }
  93.  
  94. inline int <T>SLStack::length() 
  95. {
  96.   return p.length();
  97. }
  98.  
  99. inline int <T>SLStack::OK() 
  100. {
  101.   return p.OK();
  102. }
  103.  
  104. inline void <T>SLStack::clear() 
  105. {
  106.   p.clear();
  107. }
  108.  
  109. #endif
  110.